#pragma once
#include <unordered_map>
#include <vector>
#include <string>
#include <fstream>
#include <nlohmann/json.hpp>
using json = nlohmann::json;

class Vocab {
public:
    Vocab() = default;
    explicit Vocab(const std::string& file_path);

    int operator[](const std::string& token) const;
    std::string to_tokens(int idx) const;
    void load(const std::string& file_path);

public:
    std::unordered_map<std::string, int> token_to_idx;
    std::vector<std::string> idx_to_token;
};